package repository

import (
	"context"
	"time"

	"Data-API-MCP/backend/internal/domain/entity"
)

// StatisticsRepository 统计仓库接口
type StatisticsRepository interface {
	// API调用相关
	RecordAPICall(ctx context.Context, call *entity.APICall) error
	GetAPICallStats(ctx context.Context, startTime time.Time) (map[string]interface{}, error)
	GetAPICallDetail(ctx context.Context, id string) (*entity.APICall, error)
	GetAPIErrorStats(ctx context.Context, startTime time.Time) (map[string]interface{}, error)
	GetAPIPerformance(ctx context.Context, startTime time.Time) (map[string]interface{}, error)
	GetAPICallLogs(ctx context.Context, apiID string, startTime, endTime time.Time) ([]*entity.APICall, error)

	// 数据库相关
	GetDatabaseStats(ctx context.Context) (map[string]interface{}, error)
	GetDBQueryStats(ctx context.Context, startTime time.Time) (map[string]interface{}, error)
	GetDBPerformance(ctx context.Context) (map[string]interface{}, error)
	GetDBConnectionStats(ctx context.Context) (map[string]interface{}, error)
	RecordDatabaseConnectionStats(ctx context.Context, stats *entity.DatabaseConnectionStats) error
	GetDatabaseConnectionStats(ctx context.Context, dbType string) ([]*entity.DatabaseConnectionStats, error)

	// 服务相关
	GetServiceStats(ctx context.Context, serviceID string) (*entity.ServiceStats, error)
	GetServiceHealth(ctx context.Context, serviceID string) (map[string]interface{}, error)
	GetTopServices(ctx context.Context, limit int) ([]*entity.ServiceStats, error)
	RecordServiceCallLog(ctx context.Context, log *entity.ServiceCallLog) error
	GetServiceCallLogs(ctx context.Context, serviceID string, startTime, endTime time.Time) ([]*entity.ServiceCallLog, error)

	// 系统相关
	GetSystemStatus(ctx context.Context) (map[string]interface{}, error)
	GetSystemResources(ctx context.Context) (map[string]interface{}, error)
	GetSystemLogs(ctx context.Context, startTime, endTime time.Time) ([]*entity.SystemLog, error)
}
